<template>
  <div id='DetailShop' class='DetailShop'>
    <div class="store-name">
      <div class="logo-image">
        <img :src="shop.logo" alt="">
      </div>
      <span>{{shop.name}}</span>
    </div>
    <div class="store-info">
      <div class="store-info-left">
        <div class="sells">
          <p>{{shop.sells | sellCountFilter }}</p>
          <p>总销量</p>
        </div>
        <div class="goods">
          <p>{{shop.goodsCount}}</p>
          <p>全部宝贝</p>
        </div>
      </div>
      <div class="store-info-right">
        <table>
          <tr v-for="(item,index) in shop.score" :key="index">
            <td>{{item.name}}</td>
            <td class="score" :class="{'score-better':item.isBetter}">{{item.score}}</td>
            <td class="better"><span :class="{'better-more':item.isBetter}">{{item.isBetter?'高':'低' }}</span></td>
          </tr>
        </table>
      </div>

    </div>
    <div class="stroll">
      <a href="">店铺逛逛</a>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'DetailShop',
    props: { // 父辈向子辈传参
      shop: {
        type: Object,
        default () {
          return {}
        }
      }
    },
    components: { // 组件的引用

    },
    data() {
      return {

      }
    },
    methods: { // 方法

    },
    computed: { // 计算属性

    },
    filters: {
      sellCountFilter(value) {
        let result = value;
        if (value > 10000) {
          result = (result / 10000).toFixed(1) + "万"
        }
        return result
      }
    },
    created() { // 实例被创建之后执行代码

    },
    mounted() { // 页面进入时加载内容

    },
    watch: { // 监测变化

    }
  }

</script>
<style scoped>
  .DetailShop {
    border-bottom: 5px solid #eee;
    margin-top: 30px;
    padding: 0 6px;

  }



  .store-name .logo-image {
    display: inline-block;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
  }

  .store-name .logo-image img {
    width: 100%;
    height: 100%;
  }

  .store-name span {
    position: relative;
    bottom: 20px;
    left: 15px;
    font-size: 18px;
    color: #444
  }

  .store-info {
    display: flex;
    margin-top: 30px;
    text-align: center;

  }

  .store-info>div {
    flex: 1;
  }

  .store-info-left {
    display: flex;
    height: 45px;
    line-height: 25px;
    border-right: 1px solid rgb(230, 13, 13);
    color: #444;
    /* font-family: SimHei; */
  }

  .store-info-left>div {
    flex: 1;
  }

  .store-info-left>div p:nth-of-type(1) {
    font-size: 18px;
    font-weight: 600;
  }

  .store-info-left>div p:nth-of-type(2) {
    font-size: 14px;
  }

  .store-info-right {

    position: relative;
    bottom: 24px;
    left: 30px;
    color: #444;
    font-size: 15px;
    line-height: 30px;
  }

  .score {
    padding: 0 12px;
    color: var(--color-high-text);
  }

  table {
    text-align-last: left;
  }

  .better span {
    background-color: var(--color-high-text);
  }

  .score-better {
    color: #76944c;
  }

  .better .better-more {
    background-color: #76944c;
  }

  .stroll {
    text-align: center;
    padding-bottom: 20px;
  }

</style>
